package com.example.ercmssystem2.config;

import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

@Configuration
public class PasswordGenerator {

    @Bean
    public CommandLineRunner generatePasswords() {
        return args -> {
            BCryptPasswordEncoder encoder = new BCryptPasswordEncoder(4);
            
            System.out.println("\n================================================");
            System.out.println("生成密码哈希值用于data.sql：");
            System.out.println("admin (123456): " + encoder.encode("123456"));
            System.out.println("================================================\n");
        };
    }
} 